package {
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import logout.pv.sceneloader.SceneLoader;
	import flash.display.StageQuality;
	import logout.scenes.panos.Panos;
	import flash.net.URLRequest;
	import flash.net.URLLoader;
	import logout.pv.scenes.AbstractScene;
	import org.papervision3d.Papervision3D;
	import d3s.net.papervision3d.objects.MotionCollada;
	import logout.scenes.got.GotScene;
	import logout.misc.PvWindow;
	import logout.level.AbstractLevel;
	import logout.scenes.got.GotLevel;
	import caurina.transitions.Tweener;
	import bi.conf.Configuration;
	import logout.scenes.know.KnowLevel;
	import logout.scenes.hall.HallLevel;
	import logout.scenes.home.HomeLevel;
	import logout.net.webServices.WebServiceConnector;
	
	

	[ SWF( backgroundColor='0xffffff', frameRate='40', width="1000", height="800" )]
	public class Log_OutTest extends Sprite 
	{ 
		
		public function Log_OutTest()
		{
			addEventListener( Event.ADDED_TO_STAGE, onAdded ); 
		}
		
		private function onAdded( e : Event = null ) : void {
			
			//startApp
			Papervision3D.VERBOSE = false;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			stage.quality = StageQuality.MEDIUM;
			

			Tweener.init( stage );
			
			//stage.addEventListener( Event.RESIZE, onResize );
			
			//onResize();
			
			loadLevels();
			
			
		}
		/* 
		private function onResize( e : Event = null ) : void {
			sceneContainer.x = stage.stageWidth / 2;
			sceneContainer.y = stage.stageHeight / 2;
		} */
		
		private function loadLevels() : void {
		//	var req : URLRequest = new URLRequest( "../assets/xmls/conf.xml");
			
			Configuration.getInstance().addEventListener( Event.COMPLETE,  onXmlLoaded);
			Configuration.getInstance().loadFromXml( "../assets/xmls/conf.xml" );
		
		}
		
		private function onXmlLoaded( e : Event ) : void {
			Configuration.getInstance().removeEventListener(Event.COMPLETE,  onXmlLoaded);
			
			Application.start( this );
			
		//___________________________
			/* SceneLoader.start();
			WebServiceConnector.start(); */
			
			
			/* var confqsd : Object = Configuration.getInstance().getProps() ;
			trace( "_______________________________________" );
			trace( "__________Configuration chargée________" );
			trace( "_______________________________________" );
			for( var i : String in confqsd ) {
				trace( "\t", i,"\t-->\t", confqsd[i] );
			}
			trace( "_______________________________________" );
			trace( "__________FIN     Configuration________" );
			trace( "_______________________________________" );
			 */
			
			//Application.instance.openLevel( "hall" );
			//level = new HomeLevel( "home" );
			/* level = new HallLevel( "hall" );
			//level = new GotLevel( "got" );
			//level = new KnowLevel( "know" );
			
			addChild( level );
			addChild( new FPS() );
			level.start(); */
			
		}
		
		private var level : AbstractLevel;
	}
}
